<?php

use yii\helpers\Html;
use yii\grid\GridView;
use backend\assets\AppAsset;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\ArticleSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '文章列表';
$this->params['breadcrumbs'][] = $this->title;
AppAsset::register($this);
$this->registerJsFile('@web/statics/js/plugins/jeditable/jquery.jeditable.js',['depends'=>['backend\assets\AppAsset']]);
$this->registerJsFile('@web/statics/js/plugins/dataTables/jquery.dataTables.js',['depends'=>['backend\assets\AppAsset']]);
$this->registerJsFile('@web/statics/js/plugins/dataTables/dataTables.bootstrap.js',['depends'=>['backend\assets\AppAsset']]);
?>

<div class="row">
  <div class="col-sm-12">
    <div class="ibox float-e-margins">
      <div class="ibox-title">
        <h5>
        文章列表
        </h5>
      </div>
      <div class="ibox-content">
        <div id="editable_wrapper" class="dataTables_wrapper form-inline" role="grid">
          <div class="row">
            <div class="col-sm-6">
              <div class="dataTables_length" id="editable_length">
                <label>
                  状态
                  <select name="editable_length" aria-controls="editable" class="form-control input-sm">
                    <option value="0">
                      正常
                    </option>
                    <option value="1">
                      回收站
                    </option>
                    </option>
                  </select>
                </label>
              </div>
            </div>
            <div class="col-sm-6">
              <div id="editable_filter" class="dataTables_filter">
                <label>
                  搜索
                  <input type="search" class="form-control input-sm" aria-controls="editable">
                </label>
              </div>
            </div>
          </div>
              <?= GridView::widget([
                'dataProvider' => $dataProvider,
                'columns' => [
                    ['class' => 'yii\grid\SerialColumn'],
        
                    'article_id',
                    'title',
                    'user_id',
                    'keywords',
                    // 'article_type',
                    // 'status',
                    // 'cover',
                    // 'description',
                    // 'add_time:datetime',
                    // 'update_time:datetime',
                    // 'source',
        
                    ['class' => 'yii\grid\ActionColumn','header' => '操作'],
                ],
            ]); ?>
        </div>
      </div>
    </div>
  </div>
</div>

<script>
$(document).ready(function(){$(".dataTables-example").dataTable();var oTable=$("#editable").dataTable();oTable.$("td").editable("../example_ajax.php",{"callback":function(sValue,y){var aPos=oTable.fnGetPosition(this);oTable.fnUpdate(sValue,aPos[0],aPos[1])},"submitdata":function(value,settings){return{"row_id":this.parentNode.getAttribute("id"),"column":oTable.fnGetPosition(this)[2]}},"width":"90%","height":"100%"})});
</script>

